# Copyright (c) 2024 anqi.huang@outlook.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use self file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.5)

project(libstatslog_art)

# Check if the major CMakeLists.txt file has correctly set
# the ANDROID_ROOT directory.
if (IS_DIRECTORY ${ANDROID_ROOT})
    message(STATUS "${PROJECT_NAME}, has been set android root")
else ()
    if (IS_DIRECTORY ${BUILD_NATIVE_ROOT})
        message(WARNING "${PROJECT_NAME}, set ANDROID_ROOT via BUILD_NATIVE_ROOT=${BUILD_NATIVE_ROOT}")
        set(ANDROID_ROOT ${BUILD_NATIVE_ROOT})
        set(OUT_INTERMEDIATES_ROOT ${ANDROID_ROOT}/out/soong/.intermediates)
    else ()
        message(FATAL_ERROR "${PROJECT_NAME}, ANDROID_ROOT was NULL")
    endif ()
endif ()

#################### libstatslog_art ####################
set(FILES
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.cpp/gen/statslog_art.cpp
)
set(SOURCE_FILES "")
foreach (file ${FILES})
    if (EXISTS ${file})
        list(APPEND SOURCE_FILES ${file})
    endif ()
endforeach ()

if (NOT SOURCE_FILES)
    message(WARNING "${PROJECT_NAME}, source files not exist")
else ()
    add_library(libstatslog_art SHARED ${SOURCE_FILES})

    target_include_directories(libstatslog_art
            PUBLIC
            ${ANDROID_ROOT}/art/runtime
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.cpp/gen
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.h/gen
    )

    # Add c/c++ flags
    target_compile_options(libstatslog_art PRIVATE
            -Wall
            -Werror
            -Wextra
    )

    target_link_libraries(libstatslog_art
            libc
            libc++_static
            libc++demangle
            libclang_rt.builtins
            libdl
            liblog
            libm
            libstatssocket
            libutils
    )
endif ()
#################### libstatslog_art ####################

#################### libart ####################
set(FILES
        ${ANDROID_ROOT}/art/runtime/app_info.cc
        ${ANDROID_ROOT}/art/runtime/aot_class_linker.cc
        ${ANDROID_ROOT}/art/runtime/art_field.cc
        ${ANDROID_ROOT}/art/runtime/sdk_checker.cc
        ${ANDROID_ROOT}/art/runtime/art_method.cc
        ${ANDROID_ROOT}/art/runtime/backtrace_helper.cc
        ${ANDROID_ROOT}/art/runtime/barrier.cc
        ${ANDROID_ROOT}/art/runtime/base/gc_visited_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/locks.cc
        ${ANDROID_ROOT}/art/runtime/base/mem_map_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/mutex.cc
        ${ANDROID_ROOT}/art/runtime/base/quasi_atomic.cc
        ${ANDROID_ROOT}/art/runtime/base/timing_logger.cc
        ${ANDROID_ROOT}/art/runtime/cha.cc
        ${ANDROID_ROOT}/art/runtime/class_linker.cc
        ${ANDROID_ROOT}/art/runtime/class_loader_context.cc
        ${ANDROID_ROOT}/art/runtime/class_root.cc
        ${ANDROID_ROOT}/art/runtime/class_table.cc
        ${ANDROID_ROOT}/art/runtime/common_throws.cc
        ${ANDROID_ROOT}/art/runtime/compat_framework.cc
        ${ANDROID_ROOT}/art/runtime/debug_print.cc
        ${ANDROID_ROOT}/art/runtime/debugger.cc
        ${ANDROID_ROOT}/art/runtime/dex/dex_file_annotations.cc
        ${ANDROID_ROOT}/art/runtime/dex_register_location.cc
        ${ANDROID_ROOT}/art/runtime/elf_file.cc
        ${ANDROID_ROOT}/art/runtime/exec_utils.cc
        ${ANDROID_ROOT}/art/runtime/fault_handler.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocation_record.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/art-dlmalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/rosalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/card_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/heap_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/mod_union_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/remembered_set.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/space_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/concurrent_copying.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/garbage_collector.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_region.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_spaces.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_compact.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/partial_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/semi_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/sticky_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/gc_cause.cc
        ${ANDROID_ROOT}/art/runtime/gc/heap.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_queue.cc
        ${ANDROID_ROOT}/art/runtime/gc/scoped_gc_critical_section.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/bump_pointer_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/dlmalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/image_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/large_object_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/malloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/region_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/rosalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/zygote_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/task_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/verification.cc
        ${ANDROID_ROOT}/art/runtime/handle.cc
        ${ANDROID_ROOT}/art/runtime/hidden_api.cc
        ${ANDROID_ROOT}/art/runtime/hprof/hprof.cc
        ${ANDROID_ROOT}/art/runtime/image.cc
        ${ANDROID_ROOT}/art/runtime/index_bss_mapping.cc
        ${ANDROID_ROOT}/art/runtime/indirect_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/instrumentation.cc
        ${ANDROID_ROOT}/art/runtime/intern_table.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_cache.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_common.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl0.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl1.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/lock_count_data.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/shadow_frame.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/unstarted_runtime.cc
        ${ANDROID_ROOT}/art/runtime/java_frame_root_info.cc
        ${ANDROID_ROOT}/art/runtime/javaheapprof/javaheapsampler.cc
        ${ANDROID_ROOT}/art/runtime/jit/debugger_interface.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_code_cache.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_memory_region.cc
        ${ANDROID_ROOT}/art/runtime/jit/profiling_info.cc
        ${ANDROID_ROOT}/art/runtime/jit/profile_saver.cc
        ${ANDROID_ROOT}/art/runtime/jni/check_jni.cc
        ${ANDROID_ROOT}/art/runtime/jni/java_vm_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_env_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_id_manager.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_internal.cc
        ${ANDROID_ROOT}/art/runtime/jni/local_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/method_handles.cc
        ${ANDROID_ROOT}/art/runtime/metrics/reporter.cc
        ${ANDROID_ROOT}/art/runtime/mirror/array.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class_ext.cc
        ${ANDROID_ROOT}/art/runtime/mirror/dex_cache.cc
        ${ANDROID_ROOT}/art/runtime/mirror/emulated_stack_frame.cc
        ${ANDROID_ROOT}/art/runtime/mirror/executable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/field.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handle_impl.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handles_lookup.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_type.cc
        ${ANDROID_ROOT}/art/runtime/mirror/object.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_frame_info.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_trace_element.cc
        ${ANDROID_ROOT}/art/runtime/mirror/string.cc
        ${ANDROID_ROOT}/art/runtime/mirror/throwable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/var_handle.cc
        ${ANDROID_ROOT}/art/runtime/monitor.cc
        ${ANDROID_ROOT}/art/runtime/monitor_objects_stack_visitor.cc
        ${ANDROID_ROOT}/art/runtime/native_bridge_art_interface.cc
        ${ANDROID_ROOT}/art/runtime/native_stack_dump.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_DexFile.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_BaseDexClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMDebug.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMRuntime.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMStack.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_ZygoteHooks.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Class.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Object.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StackStreamFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_String.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StringFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_System.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Thread.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Throwable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_VMClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandle.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandleImpl.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_FinalizerReference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_Reference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Array.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Constructor.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Executable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Field.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Method.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Parameter.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Proxy.cc
        ${ANDROID_ROOT}/art/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_io_Memory.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_util_CharsetUtils.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
        ${ANDROID_ROOT}/art/runtime/native/sun_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/native/jdk_internal_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/non_debuggable_classes.cc
        ${ANDROID_ROOT}/art/runtime/nterp_helpers.cc
        ${ANDROID_ROOT}/art/runtime/oat.cc
        ${ANDROID_ROOT}/art/runtime/oat_file.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant_context.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_manager.cc
        ${ANDROID_ROOT}/art/runtime/oat_quick_method_header.cc
        ${ANDROID_ROOT}/art/runtime/object_lock.cc
        ${ANDROID_ROOT}/art/runtime/offsets.cc
        ${ANDROID_ROOT}/art/runtime/parsed_options.cc
        ${ANDROID_ROOT}/art/runtime/plugin.cc
        ${ANDROID_ROOT}/art/runtime/quick_exception_handler.cc
        ${ANDROID_ROOT}/art/runtime/read_barrier.cc
        ${ANDROID_ROOT}/art/runtime/reference_table.cc
        ${ANDROID_ROOT}/art/runtime/reflection.cc
        ${ANDROID_ROOT}/art/runtime/reflective_handle_scope.cc
        ${ANDROID_ROOT}/art/runtime/reflective_value_visitor.cc
        ${ANDROID_ROOT}/art/runtime/runtime.cc
        ${ANDROID_ROOT}/art/runtime/runtime_callbacks.cc
        ${ANDROID_ROOT}/art/runtime/runtime_common.cc
        ${ANDROID_ROOT}/art/runtime/runtime_image.cc
        ${ANDROID_ROOT}/art/runtime/runtime_intrinsics.cc
        ${ANDROID_ROOT}/art/runtime/runtime_options.cc
        ${ANDROID_ROOT}/art/runtime/scoped_thread_state_change.cc
        ${ANDROID_ROOT}/art/runtime/signal_catcher.cc
        ${ANDROID_ROOT}/art/runtime/stack.cc
        ${ANDROID_ROOT}/art/runtime/stack_map.cc
        ${ANDROID_ROOT}/art/runtime/startup_completed_task.cc
        ${ANDROID_ROOT}/art/runtime/string_builder_append.cc
        ${ANDROID_ROOT}/art/runtime/thread.cc
        ${ANDROID_ROOT}/art/runtime/thread_list.cc
        ${ANDROID_ROOT}/art/runtime/thread_pool.cc
        ${ANDROID_ROOT}/art/runtime/ti/agent.cc
        ${ANDROID_ROOT}/art/runtime/trace.cc
        ${ANDROID_ROOT}/art/runtime/transaction.cc
        ${ANDROID_ROOT}/art/runtime/var_handles.cc
        ${ANDROID_ROOT}/art/runtime/vdex_file.cc
        ${ANDROID_ROOT}/art/runtime/verifier/class_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/instruction_flags.cc
        ${ANDROID_ROOT}/art/runtime/verifier/method_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type_cache.cc
        ${ANDROID_ROOT}/art/runtime/verifier/register_line.cc
        ${ANDROID_ROOT}/art/runtime/verifier/verifier_deps.cc
        ${ANDROID_ROOT}/art/runtime/verify_object.cc
        ${ANDROID_ROOT}/art/runtime/well_known_classes.cc
        ${ANDROID_ROOT}/art/runtime/arch/context.cc
        ${ANDROID_ROOT}/art/runtime/arch/instruction_set_features.cc
        ${ANDROID_ROOT}/art/runtime/arch/memcmp16.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/instruction_set_features_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/registers_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/instruction_set_features_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/registers_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/instruction_set_features_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/registers_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/instruction_set_features_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/registers_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86_64/registers_x86_64.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/entrypoint_utils.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/jni/jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_cast_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_entrypoints_enum.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_field_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_lock_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_string_builder_append_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_thread_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_throw_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/monitor_android.cc
        ${ANDROID_ROOT}/art/runtime/runtime_android.cc
        ${ANDROID_ROOT}/art/runtime/thread_android.cc
        ${ANDROID_ROOT}/art/runtime/metrics/statsd.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp_impl.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/libart_mterp.arm64ng/gen/mterp_arm64ng.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/context_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/entrypoints_init_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/jni_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/memcmp16_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/quick_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/thread_arm64.cc
        ${ANDROID_ROOT}/art/runtime/monitor_pool.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/fault_handler_arm64.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/callee_save_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/locks.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/class_status.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/compilation_kind.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc_root.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator/rosalloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/gc_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/mark_compact.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/region_space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/weak_root_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/image.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/instrumentation.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/indirect_reference_table.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jdwp_provider.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jni_id_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/linear_alloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/lock_word.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat_file.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/process_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/reflective_value_visitor.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/stack.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/suspend_reason.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/trace.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/verifier/verifier_enums.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex.cpp
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex_enums.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art_enums.cpp
)
set(SOURCE_FILES "")
foreach (file ${FILES})
    if (EXISTS ${file})
        list(APPEND SOURCE_FILES ${file})
    endif ()
endforeach ()

if (NOT SOURCE_FILES)
    message(WARNING "${PROJECT_NAME}, source files not exist")
else ()
    add_library(libart SHARED ${SOURCE_FILES})

    target_include_directories(libart
            PUBLIC
            ${ANDROID_ROOT}/art/runtime
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.h/gen
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs
    )

    # Add c/c++ flags
    target_compile_options(libart PRIVATE
            -Wall
            -Werror
            -Wextra
    )

    target_link_libraries(libart
            art_cmdlineparser_headers
            cpp-define-generator-definitions
            dlmalloc
            heapprofd_client_api
            jni_platform_headers
            libart_headers
            libartbase
            libartpalette
            libbase
            libc
            libc++
            libc++_static
            libc++demangle
            libclang_rt.builtins
            libcpu_features
            libdexfile
            libdl
            libdl_android
            libelffile
            liblog
            liblz4
            liblzma
            libm
            libnativebridge
            libnativehelper_header_only
            libnativeloader
            libnativeloader-headers
            libodrstatslog
            libprofile
            libsigchain
            libstatslog_art
            libstatssocket
            libunwindstack
            libz
    )
endif ()
#################### libart ####################

#################### libartd ####################
set(FILES
        ${ANDROID_ROOT}/art/runtime/app_info.cc
        ${ANDROID_ROOT}/art/runtime/aot_class_linker.cc
        ${ANDROID_ROOT}/art/runtime/art_field.cc
        ${ANDROID_ROOT}/art/runtime/sdk_checker.cc
        ${ANDROID_ROOT}/art/runtime/art_method.cc
        ${ANDROID_ROOT}/art/runtime/backtrace_helper.cc
        ${ANDROID_ROOT}/art/runtime/barrier.cc
        ${ANDROID_ROOT}/art/runtime/base/gc_visited_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/locks.cc
        ${ANDROID_ROOT}/art/runtime/base/mem_map_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/mutex.cc
        ${ANDROID_ROOT}/art/runtime/base/quasi_atomic.cc
        ${ANDROID_ROOT}/art/runtime/base/timing_logger.cc
        ${ANDROID_ROOT}/art/runtime/cha.cc
        ${ANDROID_ROOT}/art/runtime/class_linker.cc
        ${ANDROID_ROOT}/art/runtime/class_loader_context.cc
        ${ANDROID_ROOT}/art/runtime/class_root.cc
        ${ANDROID_ROOT}/art/runtime/class_table.cc
        ${ANDROID_ROOT}/art/runtime/common_throws.cc
        ${ANDROID_ROOT}/art/runtime/compat_framework.cc
        ${ANDROID_ROOT}/art/runtime/debug_print.cc
        ${ANDROID_ROOT}/art/runtime/debugger.cc
        ${ANDROID_ROOT}/art/runtime/dex/dex_file_annotations.cc
        ${ANDROID_ROOT}/art/runtime/dex_register_location.cc
        ${ANDROID_ROOT}/art/runtime/elf_file.cc
        ${ANDROID_ROOT}/art/runtime/exec_utils.cc
        ${ANDROID_ROOT}/art/runtime/fault_handler.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocation_record.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/art-dlmalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/rosalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/card_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/heap_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/mod_union_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/remembered_set.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/space_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/concurrent_copying.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/garbage_collector.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_region.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_spaces.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_compact.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/partial_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/semi_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/sticky_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/gc_cause.cc
        ${ANDROID_ROOT}/art/runtime/gc/heap.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_queue.cc
        ${ANDROID_ROOT}/art/runtime/gc/scoped_gc_critical_section.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/bump_pointer_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/dlmalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/image_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/large_object_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/malloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/region_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/rosalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/zygote_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/task_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/verification.cc
        ${ANDROID_ROOT}/art/runtime/handle.cc
        ${ANDROID_ROOT}/art/runtime/hidden_api.cc
        ${ANDROID_ROOT}/art/runtime/hprof/hprof.cc
        ${ANDROID_ROOT}/art/runtime/image.cc
        ${ANDROID_ROOT}/art/runtime/index_bss_mapping.cc
        ${ANDROID_ROOT}/art/runtime/indirect_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/instrumentation.cc
        ${ANDROID_ROOT}/art/runtime/intern_table.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_cache.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_common.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl0.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl1.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/lock_count_data.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/shadow_frame.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/unstarted_runtime.cc
        ${ANDROID_ROOT}/art/runtime/java_frame_root_info.cc
        ${ANDROID_ROOT}/art/runtime/javaheapprof/javaheapsampler.cc
        ${ANDROID_ROOT}/art/runtime/jit/debugger_interface.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_code_cache.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_memory_region.cc
        ${ANDROID_ROOT}/art/runtime/jit/profiling_info.cc
        ${ANDROID_ROOT}/art/runtime/jit/profile_saver.cc
        ${ANDROID_ROOT}/art/runtime/jni/check_jni.cc
        ${ANDROID_ROOT}/art/runtime/jni/java_vm_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_env_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_id_manager.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_internal.cc
        ${ANDROID_ROOT}/art/runtime/jni/local_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/method_handles.cc
        ${ANDROID_ROOT}/art/runtime/metrics/reporter.cc
        ${ANDROID_ROOT}/art/runtime/mirror/array.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class_ext.cc
        ${ANDROID_ROOT}/art/runtime/mirror/dex_cache.cc
        ${ANDROID_ROOT}/art/runtime/mirror/emulated_stack_frame.cc
        ${ANDROID_ROOT}/art/runtime/mirror/executable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/field.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handle_impl.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handles_lookup.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_type.cc
        ${ANDROID_ROOT}/art/runtime/mirror/object.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_frame_info.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_trace_element.cc
        ${ANDROID_ROOT}/art/runtime/mirror/string.cc
        ${ANDROID_ROOT}/art/runtime/mirror/throwable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/var_handle.cc
        ${ANDROID_ROOT}/art/runtime/monitor.cc
        ${ANDROID_ROOT}/art/runtime/monitor_objects_stack_visitor.cc
        ${ANDROID_ROOT}/art/runtime/native_bridge_art_interface.cc
        ${ANDROID_ROOT}/art/runtime/native_stack_dump.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_DexFile.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_BaseDexClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMDebug.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMRuntime.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMStack.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_ZygoteHooks.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Class.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Object.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StackStreamFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_String.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StringFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_System.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Thread.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Throwable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_VMClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandle.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandleImpl.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_FinalizerReference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_Reference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Array.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Constructor.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Executable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Field.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Method.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Parameter.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Proxy.cc
        ${ANDROID_ROOT}/art/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_io_Memory.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_util_CharsetUtils.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
        ${ANDROID_ROOT}/art/runtime/native/sun_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/native/jdk_internal_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/non_debuggable_classes.cc
        ${ANDROID_ROOT}/art/runtime/nterp_helpers.cc
        ${ANDROID_ROOT}/art/runtime/oat.cc
        ${ANDROID_ROOT}/art/runtime/oat_file.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant_context.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_manager.cc
        ${ANDROID_ROOT}/art/runtime/oat_quick_method_header.cc
        ${ANDROID_ROOT}/art/runtime/object_lock.cc
        ${ANDROID_ROOT}/art/runtime/offsets.cc
        ${ANDROID_ROOT}/art/runtime/parsed_options.cc
        ${ANDROID_ROOT}/art/runtime/plugin.cc
        ${ANDROID_ROOT}/art/runtime/quick_exception_handler.cc
        ${ANDROID_ROOT}/art/runtime/read_barrier.cc
        ${ANDROID_ROOT}/art/runtime/reference_table.cc
        ${ANDROID_ROOT}/art/runtime/reflection.cc
        ${ANDROID_ROOT}/art/runtime/reflective_handle_scope.cc
        ${ANDROID_ROOT}/art/runtime/reflective_value_visitor.cc
        ${ANDROID_ROOT}/art/runtime/runtime.cc
        ${ANDROID_ROOT}/art/runtime/runtime_callbacks.cc
        ${ANDROID_ROOT}/art/runtime/runtime_common.cc
        ${ANDROID_ROOT}/art/runtime/runtime_image.cc
        ${ANDROID_ROOT}/art/runtime/runtime_intrinsics.cc
        ${ANDROID_ROOT}/art/runtime/runtime_options.cc
        ${ANDROID_ROOT}/art/runtime/scoped_thread_state_change.cc
        ${ANDROID_ROOT}/art/runtime/signal_catcher.cc
        ${ANDROID_ROOT}/art/runtime/stack.cc
        ${ANDROID_ROOT}/art/runtime/stack_map.cc
        ${ANDROID_ROOT}/art/runtime/startup_completed_task.cc
        ${ANDROID_ROOT}/art/runtime/string_builder_append.cc
        ${ANDROID_ROOT}/art/runtime/thread.cc
        ${ANDROID_ROOT}/art/runtime/thread_list.cc
        ${ANDROID_ROOT}/art/runtime/thread_pool.cc
        ${ANDROID_ROOT}/art/runtime/ti/agent.cc
        ${ANDROID_ROOT}/art/runtime/trace.cc
        ${ANDROID_ROOT}/art/runtime/transaction.cc
        ${ANDROID_ROOT}/art/runtime/var_handles.cc
        ${ANDROID_ROOT}/art/runtime/vdex_file.cc
        ${ANDROID_ROOT}/art/runtime/verifier/class_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/instruction_flags.cc
        ${ANDROID_ROOT}/art/runtime/verifier/method_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type_cache.cc
        ${ANDROID_ROOT}/art/runtime/verifier/register_line.cc
        ${ANDROID_ROOT}/art/runtime/verifier/verifier_deps.cc
        ${ANDROID_ROOT}/art/runtime/verify_object.cc
        ${ANDROID_ROOT}/art/runtime/well_known_classes.cc
        ${ANDROID_ROOT}/art/runtime/arch/context.cc
        ${ANDROID_ROOT}/art/runtime/arch/instruction_set_features.cc
        ${ANDROID_ROOT}/art/runtime/arch/memcmp16.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/instruction_set_features_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/registers_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/instruction_set_features_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/registers_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/instruction_set_features_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/registers_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/instruction_set_features_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/registers_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86_64/registers_x86_64.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/entrypoint_utils.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/jni/jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_cast_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_entrypoints_enum.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_field_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_lock_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_string_builder_append_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_thread_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_throw_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/monitor_android.cc
        ${ANDROID_ROOT}/art/runtime/runtime_android.cc
        ${ANDROID_ROOT}/art/runtime/thread_android.cc
        ${ANDROID_ROOT}/art/runtime/metrics/statsd.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp_impl.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/libart_mterp.arm64ng/gen/mterp_arm64ng.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/context_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/entrypoints_init_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/jni_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/memcmp16_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/quick_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/thread_arm64.cc
        ${ANDROID_ROOT}/art/runtime/monitor_pool.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/fault_handler_arm64.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/callee_save_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/locks.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/class_status.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/compilation_kind.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc_root.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator/rosalloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/gc_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/mark_compact.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/region_space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/weak_root_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/image.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/instrumentation.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/indirect_reference_table.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jdwp_provider.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jni_id_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/linear_alloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/lock_word.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat_file.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/process_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/reflective_value_visitor.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/stack.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/suspend_reason.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/trace.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/verifier/verifier_enums.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex.cpp
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex_enums.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art_enums.cpp
)
set(SOURCE_FILES "")
foreach (file ${FILES})
    if (EXISTS ${file})
        list(APPEND SOURCE_FILES ${file})
    endif ()
endforeach ()

if (NOT SOURCE_FILES)
    message(WARNING "${PROJECT_NAME}, source files not exist")
else ()
    add_library(libartd SHARED ${SOURCE_FILES})

    target_include_directories(libartd
            PUBLIC
            ${ANDROID_ROOT}/art/runtime
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.h/gen
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs
    )

    # Add c/c++ flags
    target_compile_options(libartd PRIVATE
            -Wall
            -Werror
            -Wextra
            -DVIXL_DEBUG
            -UNDEBUG
    )

    target_link_libraries(libartd
            art_cmdlineparser_headers
            cpp-define-generator-definitions
            dlmalloc
            heapprofd_client_api
            jni_platform_headers
            libart_headers
            libartbased
            libartpalette
            libbase
            libc
            libc++
            libc++_static
            libc++demangle
            libclang_rt.builtins
            libcpu_features
            libdexfiled
            libdl
            libdl_android
            libelffiled
            liblog
            liblz4
            liblzma
            libm
            libnativebridge
            libnativehelper_header_only
            libnativeloader
            libnativeloader-headers
            libodrstatslog
            libprofiled
            libsigchain
            libstatslog_art
            libstatssocket
            libunwindstack
            libz
    )
endif ()
#################### libartd ####################

#################### libart-broken ####################
set(FILES
        ${ANDROID_ROOT}/art/runtime/app_info.cc
        ${ANDROID_ROOT}/art/runtime/aot_class_linker.cc
        ${ANDROID_ROOT}/art/runtime/art_field.cc
        ${ANDROID_ROOT}/art/runtime/sdk_checker.cc
        ${ANDROID_ROOT}/art/runtime/art_method.cc
        ${ANDROID_ROOT}/art/runtime/backtrace_helper.cc
        ${ANDROID_ROOT}/art/runtime/barrier.cc
        ${ANDROID_ROOT}/art/runtime/base/gc_visited_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/locks.cc
        ${ANDROID_ROOT}/art/runtime/base/mem_map_arena_pool.cc
        ${ANDROID_ROOT}/art/runtime/base/mutex.cc
        ${ANDROID_ROOT}/art/runtime/base/quasi_atomic.cc
        ${ANDROID_ROOT}/art/runtime/base/timing_logger.cc
        ${ANDROID_ROOT}/art/runtime/cha.cc
        ${ANDROID_ROOT}/art/runtime/class_linker.cc
        ${ANDROID_ROOT}/art/runtime/class_loader_context.cc
        ${ANDROID_ROOT}/art/runtime/class_root.cc
        ${ANDROID_ROOT}/art/runtime/class_table.cc
        ${ANDROID_ROOT}/art/runtime/common_throws.cc
        ${ANDROID_ROOT}/art/runtime/compat_framework.cc
        ${ANDROID_ROOT}/art/runtime/debug_print.cc
        ${ANDROID_ROOT}/art/runtime/debugger.cc
        ${ANDROID_ROOT}/art/runtime/dex/dex_file_annotations.cc
        ${ANDROID_ROOT}/art/runtime/dex_register_location.cc
        ${ANDROID_ROOT}/art/runtime/elf_file.cc
        ${ANDROID_ROOT}/art/runtime/exec_utils.cc
        ${ANDROID_ROOT}/art/runtime/fault_handler.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocation_record.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/art-dlmalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/allocator/rosalloc.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/card_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/heap_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/mod_union_table.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/remembered_set.cc
        ${ANDROID_ROOT}/art/runtime/gc/accounting/space_bitmap.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/concurrent_copying.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/garbage_collector.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_region.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/immune_spaces.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_compact.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/partial_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/semi_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/collector/sticky_mark_sweep.cc
        ${ANDROID_ROOT}/art/runtime/gc/gc_cause.cc
        ${ANDROID_ROOT}/art/runtime/gc/heap.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/reference_queue.cc
        ${ANDROID_ROOT}/art/runtime/gc/scoped_gc_critical_section.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/bump_pointer_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/dlmalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/image_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/large_object_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/malloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/region_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/rosalloc_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/space.cc
        ${ANDROID_ROOT}/art/runtime/gc/space/zygote_space.cc
        ${ANDROID_ROOT}/art/runtime/gc/task_processor.cc
        ${ANDROID_ROOT}/art/runtime/gc/verification.cc
        ${ANDROID_ROOT}/art/runtime/handle.cc
        ${ANDROID_ROOT}/art/runtime/hidden_api.cc
        ${ANDROID_ROOT}/art/runtime/hprof/hprof.cc
        ${ANDROID_ROOT}/art/runtime/image.cc
        ${ANDROID_ROOT}/art/runtime/index_bss_mapping.cc
        ${ANDROID_ROOT}/art/runtime/indirect_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/instrumentation.cc
        ${ANDROID_ROOT}/art/runtime/intern_table.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_cache.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_common.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl0.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/interpreter_switch_impl1.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/lock_count_data.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/shadow_frame.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/unstarted_runtime.cc
        ${ANDROID_ROOT}/art/runtime/java_frame_root_info.cc
        ${ANDROID_ROOT}/art/runtime/javaheapprof/javaheapsampler.cc
        ${ANDROID_ROOT}/art/runtime/jit/debugger_interface.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_code_cache.cc
        ${ANDROID_ROOT}/art/runtime/jit/jit_memory_region.cc
        ${ANDROID_ROOT}/art/runtime/jit/profiling_info.cc
        ${ANDROID_ROOT}/art/runtime/jit/profile_saver.cc
        ${ANDROID_ROOT}/art/runtime/jni/check_jni.cc
        ${ANDROID_ROOT}/art/runtime/jni/java_vm_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_env_ext.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_id_manager.cc
        ${ANDROID_ROOT}/art/runtime/jni/jni_internal.cc
        ${ANDROID_ROOT}/art/runtime/jni/local_reference_table.cc
        ${ANDROID_ROOT}/art/runtime/method_handles.cc
        ${ANDROID_ROOT}/art/runtime/metrics/reporter.cc
        ${ANDROID_ROOT}/art/runtime/mirror/array.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class.cc
        ${ANDROID_ROOT}/art/runtime/mirror/class_ext.cc
        ${ANDROID_ROOT}/art/runtime/mirror/dex_cache.cc
        ${ANDROID_ROOT}/art/runtime/mirror/emulated_stack_frame.cc
        ${ANDROID_ROOT}/art/runtime/mirror/executable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/field.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handle_impl.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_handles_lookup.cc
        ${ANDROID_ROOT}/art/runtime/mirror/method_type.cc
        ${ANDROID_ROOT}/art/runtime/mirror/object.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_frame_info.cc
        ${ANDROID_ROOT}/art/runtime/mirror/stack_trace_element.cc
        ${ANDROID_ROOT}/art/runtime/mirror/string.cc
        ${ANDROID_ROOT}/art/runtime/mirror/throwable.cc
        ${ANDROID_ROOT}/art/runtime/mirror/var_handle.cc
        ${ANDROID_ROOT}/art/runtime/monitor.cc
        ${ANDROID_ROOT}/art/runtime/monitor_objects_stack_visitor.cc
        ${ANDROID_ROOT}/art/runtime/native_bridge_art_interface.cc
        ${ANDROID_ROOT}/art/runtime/native_stack_dump.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_DexFile.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_BaseDexClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMDebug.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMRuntime.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_VMStack.cc
        ${ANDROID_ROOT}/art/runtime/native/dalvik_system_ZygoteHooks.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Class.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Object.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StackStreamFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_String.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_StringFactory.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_System.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Thread.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_Throwable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_VMClassLoader.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandle.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_invoke_MethodHandleImpl.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_FinalizerReference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_ref_Reference.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Array.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Constructor.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Executable.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Field.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Method.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Parameter.cc
        ${ANDROID_ROOT}/art/runtime/native/java_lang_reflect_Proxy.cc
        ${ANDROID_ROOT}/art/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_io_Memory.cc
        ${ANDROID_ROOT}/art/runtime/native/libcore_util_CharsetUtils.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
        ${ANDROID_ROOT}/art/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
        ${ANDROID_ROOT}/art/runtime/native/sun_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/native/jdk_internal_misc_Unsafe.cc
        ${ANDROID_ROOT}/art/runtime/non_debuggable_classes.cc
        ${ANDROID_ROOT}/art/runtime/nterp_helpers.cc
        ${ANDROID_ROOT}/art/runtime/oat.cc
        ${ANDROID_ROOT}/art/runtime/oat_file.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_assistant_context.cc
        ${ANDROID_ROOT}/art/runtime/oat_file_manager.cc
        ${ANDROID_ROOT}/art/runtime/oat_quick_method_header.cc
        ${ANDROID_ROOT}/art/runtime/object_lock.cc
        ${ANDROID_ROOT}/art/runtime/offsets.cc
        ${ANDROID_ROOT}/art/runtime/parsed_options.cc
        ${ANDROID_ROOT}/art/runtime/plugin.cc
        ${ANDROID_ROOT}/art/runtime/quick_exception_handler.cc
        ${ANDROID_ROOT}/art/runtime/read_barrier.cc
        ${ANDROID_ROOT}/art/runtime/reference_table.cc
        ${ANDROID_ROOT}/art/runtime/reflection.cc
        ${ANDROID_ROOT}/art/runtime/reflective_handle_scope.cc
        ${ANDROID_ROOT}/art/runtime/reflective_value_visitor.cc
        ${ANDROID_ROOT}/art/runtime/runtime.cc
        ${ANDROID_ROOT}/art/runtime/runtime_callbacks.cc
        ${ANDROID_ROOT}/art/runtime/runtime_common.cc
        ${ANDROID_ROOT}/art/runtime/runtime_image.cc
        ${ANDROID_ROOT}/art/runtime/runtime_intrinsics.cc
        ${ANDROID_ROOT}/art/runtime/runtime_options.cc
        ${ANDROID_ROOT}/art/runtime/scoped_thread_state_change.cc
        ${ANDROID_ROOT}/art/runtime/signal_catcher.cc
        ${ANDROID_ROOT}/art/runtime/stack.cc
        ${ANDROID_ROOT}/art/runtime/stack_map.cc
        ${ANDROID_ROOT}/art/runtime/startup_completed_task.cc
        ${ANDROID_ROOT}/art/runtime/string_builder_append.cc
        ${ANDROID_ROOT}/art/runtime/thread.cc
        ${ANDROID_ROOT}/art/runtime/thread_list.cc
        ${ANDROID_ROOT}/art/runtime/thread_pool.cc
        ${ANDROID_ROOT}/art/runtime/ti/agent.cc
        ${ANDROID_ROOT}/art/runtime/trace.cc
        ${ANDROID_ROOT}/art/runtime/transaction.cc
        ${ANDROID_ROOT}/art/runtime/var_handles.cc
        ${ANDROID_ROOT}/art/runtime/vdex_file.cc
        ${ANDROID_ROOT}/art/runtime/verifier/class_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/instruction_flags.cc
        ${ANDROID_ROOT}/art/runtime/verifier/method_verifier.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type.cc
        ${ANDROID_ROOT}/art/runtime/verifier/reg_type_cache.cc
        ${ANDROID_ROOT}/art/runtime/verifier/register_line.cc
        ${ANDROID_ROOT}/art/runtime/verifier/verifier_deps.cc
        ${ANDROID_ROOT}/art/runtime/verify_object.cc
        ${ANDROID_ROOT}/art/runtime/well_known_classes.cc
        ${ANDROID_ROOT}/art/runtime/arch/context.cc
        ${ANDROID_ROOT}/art/runtime/arch/instruction_set_features.cc
        ${ANDROID_ROOT}/art/runtime/arch/memcmp16.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/instruction_set_features_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm/registers_arm.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/instruction_set_features_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/registers_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/instruction_set_features_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/riscv64/registers_riscv64.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/instruction_set_features_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86/registers_x86.cc
        ${ANDROID_ROOT}/art/runtime/arch/x86_64/registers_x86_64.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/entrypoint_utils.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/jni/jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_cast_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_entrypoints_enum.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_field_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_jni_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_lock_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_math_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_string_builder_append_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_thread_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_throw_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
        ${ANDROID_ROOT}/art/runtime/monitor_android.cc
        ${ANDROID_ROOT}/art/runtime/runtime_android.cc
        ${ANDROID_ROOT}/art/runtime/thread_android.cc
        ${ANDROID_ROOT}/art/runtime/metrics/statsd.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp.cc
        ${ANDROID_ROOT}/art/runtime/interpreter/mterp/nterp_impl.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/libart_mterp.arm64ng/gen/mterp_arm64ng.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/context_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/entrypoints_init_arm64.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/jni_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/memcmp16_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/quick_entrypoints_arm64.S
        ${ANDROID_ROOT}/art/runtime/arch/arm64/thread_arm64.cc
        ${ANDROID_ROOT}/art/runtime/monitor_pool.cc
        ${ANDROID_ROOT}/art/runtime/arch/arm64/fault_handler_arm64.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/callee_save_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/base/locks.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/class_status.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/compilation_kind.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc_root.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/allocator/rosalloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/gc_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/collector/mark_compact.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/region_space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/space/space.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/gc/weak_root_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/image.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/instrumentation.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/indirect_reference_table.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jdwp_provider.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/jni_id_type.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/linear_alloc.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/lock_word.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/oat_file.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/process_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/reflective_value_visitor.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/stack.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/suspend_reason.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/thread_state.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/trace.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs/art/runtime/verifier/verifier_enums.operator_out.cc
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex.cpp
        ${OUT_INTERMEDIATES_ROOT}/system/apex/apexd/apex-info-list-tinyxml/gen/cpp/com_android_apex_enums.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art.cpp
        ${OUT_INTERMEDIATES_ROOT}/art/odrefresh/art-apex-cache-info/gen/cpp/com_android_art_enums.cpp
)
set(SOURCE_FILES "")
foreach (file ${FILES})
    if (EXISTS ${file})
        list(APPEND SOURCE_FILES ${file})
    endif ()
endforeach ()

if (NOT SOURCE_FILES)
    message(WARNING "${PROJECT_NAME}, source files not exist")
else ()
    add_library(libart-broken SHARED ${SOURCE_FILES})

    target_include_directories(libart-broken
            PUBLIC
            ${ANDROID_ROOT}/art/runtime
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/statslog_art.h/gen
            ${OUT_INTERMEDIATES_ROOT}/art/runtime/art_operator_srcs/gen/gensrcs
    )

    # Add c/c++ flags
    target_compile_options(libart-broken PRIVATE
            -Wall
            -Werror
            -Wextra
    )

    target_link_libraries(libart-broken
            art_cmdlineparser_headers
            cpp-define-generator-definitions
            dlmalloc
            heapprofd_client_api
            jni_platform_headers
            libart_headers
            libartbase
            libartpalette
            libbase
            libc
            libc++
            libc++_static
            libc++demangle
            libclang_rt.builtins
            libcpu_features
            libdexfile
            libdl
            libdl_android
            libelffile
            liblog
            liblz4
            liblzma
            libm
            libnativebridge
            libnativehelper_header_only
            libnativeloader
            libnativeloader-headers
            libodrstatslog
            libprofile
            libsigchain
            libstatslog_art
            libstatssocket
            libunwindstack
            libz
    )
endif ()
#################### libart-broken ####################
